<template>
  <div class="main">
    <el-container class="container">
      <el-aside :width="isCollapse ? '60px' : '210px'" class="aside">
        <NavMenu :isCollapse="isCollapse" />
      </el-aside>
      <el-container>
        <el-header class="header">
          <NavHeader @asidechange="asidechange"></NavHeader>
        </el-header>
        <!-- el-main 默认有padding:20px -->
        <el-main class="main">
          <el-scrollbar height="100%">
            <div class="page-info">
              <router-view />
            </div>
          </el-scrollbar>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import NavMenu from '@/components/nav-menu'
import NavHeader from '@/components/nav-header'
export default defineComponent({
  components: { NavMenu, NavHeader },
  setup() {
    const isCollapse = ref(false)
    const asidechange = (isShowAside: boolean) => {
      isCollapse.value = isShowAside
    }
    return {
      isCollapse,
      asidechange
    }
  }
})
</script>

<style scoped lang="less">
.main {
  height: 100%;
  height: 100%;
  .container {
    width: 100%;
    height: 100%;
    .aside {
      background-color: #001529;
    }
    .header {
      width: 100%;
      height: 48px !important;
    }
    .main {
      width: 100%;
      background-color: #f5f5f5;
      color: #333;
      text-align: center;
      .page-info {
        background-color: #f5f5f5;
        border-radius: 6px;
      }
    }
  }
}
</style>
